<%@ page language="java" pageEncoding="UTF-8"%>
<div ng-controller="OpenApiShowController">
	<div class="panel panel-default">
		<div class="panel-heading">
			API管理
			<span class="pull-right">
				<button type="button" class="btn btn-default btn-sm" ng-click="create()"><i class="glyphicon glyphicon-plus-sign"></i> 添加</button>
			</span>
		</div>
		<div class="panel-body">
			<div class="panel-group">
		        <div class="panel panel-default" ng-repeat="api in apis.root">
		            <div class="panel-heading">
		                <h4 class="panel-title">
		                    <span message="'ID:{{api.id}}'" tooltip>{{api.name}}</span>
		                    <span class="pull-right">
		                    	<button class="btn btn-success btn-xs" ng-click="edit(api)"><i class="glyphicon glyphicon-edit"></i> 编辑</button>
								<button class="btn btn-danger btn-xs" ng-click="remove(api)"><i class="glyphicon glyphicon-remove"></i> 删除</button>
								<span class="badge">{{api.children.length}}</span>
		                    </span>
		                </h4>
		            </div>
		            <div class="panel-collapse collapse" ng-class="{'in':api.children.length!=0}">
		                <div class="panel-body">
		                    <table class="table">
		                        <thead>
		                       		<tr>
										<th>
											ID
										</th>
										<th>
											名称
										</th>
										<th>
											索引
										</th>
										<th>
											操作
										</th>
									</tr>
								</thead>
								<tbody>
		                        	<tr ng-repeat="children in api.children">
		                        		<td>
							     			{{children.id}}
							     		</td>
							     		<td>
							     			{{children.name}}
							     		</td>
							     		<td>
							     			{{children.index}}
							     		</td>
							        	<td>
							        		<button class="btn btn-success btn-xs" ng-click="edit(children)"><i class="glyphicon glyphicon-edit"></i> 编辑</button>
											<button class="btn btn-danger btn-xs" ng-click="remove(children)"><i class="glyphicon glyphicon-remove"></i> 删除</button>
							        	</td>
		                        	</tr>
		                    	</tbody>
		                    </table>
		                </div>
		            </div>
		        </div>
		    </div>
		</div>
	</div>
	
	<div class="panel panel-default">
		<div class="panel-heading">
			错误的节点 [没有根节点]
		</div>
		<div class="panel-body">
			<table class="table table-hover">
				<thead>
					<tr>
						<th>
							ID
						</th>
						<th>
							名称
						</th>
						<th>
							父节点
						</th>
						<th>
							索引
						</th>
						<th>
							操作
						</th>
					</tr>
				</thead>
				<tbody>
					<tr ng-repeat="api in apis.error">
						<td>
							{{api.id}}
						</td>
						<td>
							{{api.name}}
						</td>
						<td>
							{{api.parent}}
						</td>
						<td>
							{{api.index}}
						</td>
						<td>
							<button class="btn btn-success btn-xs" ng-click="edit(api)"><i class="glyphicon glyphicon-edit"></i> 编辑</button>
							<button class="btn btn-danger btn-xs" ng-click="remove(api)"><i class="glyphicon glyphicon-remove"></i> 删除</button>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
</div>